/**
 * @file Driver_W25Q16.h
 * @brief 
 * @author 2bam 
 * @version 1.0
 * @date 2024-11-25
 * @copyright Copyright (c) 2024  NULL
 * 
 * @change log:
 * Date           Version Author   Describe
 * 2024-11-25     1.0     2bam     first version
 */


#ifndef DRIVER_W25Q_H
#define DRIVER_W25Q_H


#ifdef __cplusplus
extern  {
#endif


/* Includes -------------------------------------------------------------------*/

/* define ---------------------------------------------------------------------*/
#define W25X_WriteEnable		        0x06 
#define W25X_WriteDisable		        0x04 
#define W25X_ReadStatusReg1		        0x05 
#define W25X_WriteStatusReg		        0x01 
#define W25X_ReadData			        0x03 
#define W25X_FastReadData		        0x0B 
#define W25X_FastReadDual		        0x3B 
#define W25X_PageProgram		        0x02 
#define W25X_BlockErase			        0xD8 
#define W25X_SectorErase		        0x20 
#define W25X_ChipErase			        0xC7 
#define W25X_PowerDown			        0xB9 
#define W25X_ReleasePowerDown	        0xAB 
#define W25X_DeviceID			        0xAB 
#define W25X_ManufactDeviceID   	    0x90 
#define W25X_JedecDeviceID		        0x9F 
#define WIP_Flag                        0x01  /* Write In Progress (WIP) flag */

#define Dummy_Byte                      0xFF

/* typedef --------------------------------------------------------------------*/

/* variables ------------------------------------------------------------------*/

/* Private function prototypes ------------------------------------------------*/


void W25QInit(void);
void W25QReadID(uint8_t *MID, uint16_t *DID);
void W25QSectorErase(uint32_t addr);
void W25QReadData(uint32_t addr, uint8_t *data_array, uint32_t count);
void W25QPageProgram(uint32_t addr, uint8_t *data_array, uint16_t count);

#ifdef __cplusplus
}
#endif
#endif